//分支流水线脚本
node {

    stage('build'){
        checkout([$class: 'GitSCM', branches: [[name: '*/develop']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '7da317fe-8eed-42e3-9966-287f59a3383c', url: 'http://git.epochn.com/echronos_arch/ech-nms.git']]])
		echo "当前分支 : ${env.BRANCH_NAME}"
        echo "当前环境 : ${env.env}"
              //      sh "echo 当前提交 : ${env.commit}"
                //    sh "echo WORKSPACE : ${env.WORKSPACE}"
                  //  sh "echo GIT_BRANCH : ${env.GIT_BRANCH}"
                    //sh "echo BUILD_NUMBER : ${env.BUILD_NUMBER}"
                    //sh "echo JOB_NAME : ${env.JOB_NAME}"
        //sh label: '', script: 'mvn clean package install'
    }
    stage("发布开发环境"){
        echo "IP: $DEV_ENV_IP  job:  $JOB_NAME"
        timeout(time: 7, unit: 'DAYS') {
            input message: '是否发布到开发环境？',ok: 'Yes'
        }
        sh label: '',script: '$JENKINS_HOME/jenkins_deploy.sh dev $JOB_NAME  $IS_HORIZONTAL_EXPANSION $DEV_ENV_IP '
    }
    stage("发布测试环境"){
        timeout(time: 7, unit: 'DAYS') {
            input message: '是否发布到测试环境？',ok: 'Yes'
        }
        sh label: '',script: '$JENKINS_HOME/jenkins_deploy.sh test $JOB_NAME  $IS_HORIZONTAL_EXPANSION $TEST_ENV_IP '
    }
    stage('发布预生产环境') {
        timeout(time: 7, unit: 'DAYS') {
            input message: '是否发布到预生产？',ok: 'Yes'
        }
        sh label: '', script: '$JENKINS_HOME/jenkins_deploy.sh pre_prod $JOB_NAME  $IS_HORIZONTAL_EXPANSION $DEV_ENV_IP '
    }
    stage('push_online1') {
        timeout(time: 7, unit: 'DAYS') {
            input message: '是否发布到生产online1？',ok: 'Yes'
        }
        sh label: '', script: '$JENKINS_HOME/jenkins_deploy.sh online1 $JOB_NAME  $IS_HORIZONTAL_EXPANSION $DEV_ENV_IP '
    }
    stage('push_online2') {
        timeout(time: 7, unit: 'DAYS') {
            input message: '是否发布到生产online2？',ok: 'Yes'
        }
        sh label: '', script: '$JENKINS_HOME/jenkins_deploy.sh online2'
    }
    
}